<?php
/**
 * Created by PhpStorm.
 * User: woody
 * Date: 17-2-16
 * Time: 下午10:46
 */

namespace App\Http\Controllers\Api;
use App\Models\Roomdataapi;
use Illuminate\Http\Request;

class RoomdataController extends ApiController {

    public function __construct()
    {
        parent::__construct();
        $this->_response['_active']['_model']       = 'roomdata';
        $this->_response['_active']['_action']      = '';
        $this->_response['_title']                  = '小一农货-房型管理';
    }

    /**
     * Created by PhpStorm.
     * User: 获取房型数据
     * Date: 17-2-16
     * Time: 下午10:46
     */
    public function index(){

        $this->_response['_active']['_action']      = 'list';

        $roomdataModel = new Roomdataapi();

        $data = $roomdataModel->getData();
        if(!empty($data)){
            $this->_response['roomdata'] = $data;
            return response()->json(['code' => 0, 'msg' => '返回成功','data'=>$this->_response]);
        }else{
            return response()->json(['code' => -1, 'msg' => '返回失败']);
        }
    }


}